package xyz.syyrjx.call.load;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import xyz.syyrjx.call.proxy.SyyrjxRpcCallClientProxy;
import xyz.syyrjx.consumer.client.SyyrjxRpcConsumerClient;

/**
 * @author 大地崩坏苍蝇兽
 * @date 2023/1/22 - 16:43
 */
public class SyyrjxRpcCallApplicationContextAware implements ApplicationContextAware {
    private final static Logger LOGGER = LoggerFactory.getLogger(SyyrjxRpcCallApplicationContextAware.class);
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        SyyrjxRpcConsumerClient client = applicationContext.getBean(SyyrjxRpcConsumerClient.class);
        LOGGER.debug("拿到客户端服务器" + client);
        SyyrjxRpcCallClientProxy.setClient(client);
    }
}
